-
Notifications
You must be signed in to change notification settings - Fork 7.9k
Reorganize ext/uri tests - withers #19970
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: PHP-8.5
Are you sure you want to change the base?
Conversation
ext/uri/tests/whatwg/modification/host_error_forbidden_host_codepoint_opaque2.phpt
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The ^ character is in the percent-encode set of the path (https://url.spec.whatwg.org/#path-percent-encode-set), but somehow it's not percent-encoded.
00e380e
to
dd5e549
Compare
dd5e549
to
059b1a1
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I went through all RFC 3986 tests. Looking pretty good overall, some nits. I also think it would be helpful to print the entire resulting URL in addition to printing the output of the getters, this makes it easier to double-check how exactly the resulting URL will look, particularly with regard to the difference between null
and ""
(e.g. whether there is a ?
for the query or not).
ext/uri/tests/rfc3986/modification/fragment_success_encoded.phpt
Outdated
Show resolved
Hide resolved
<?php | ||
|
||
$uri1 = Uri\Rfc3986\Uri::parse("https://example.com"); | ||
$uri2 = $uri1->withFragment("foo%3Dbar"); // foo=bar |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should this also have a normalizable percent-encoded character similarly to ext/uri/tests/rfc3986/modification/host_success_encoded.phpt
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This seems to be unresolved still.
ext/uri/tests/rfc3986/modification/userinfo_success_existing.phpt
Outdated
Show resolved
Hide resolved
Yes, I was also thinking about something similar (at least in some edge cases), but I didn't want to make the output too "crowded". My other concern is that most states can be tested via regular parsing 🤔 (we don't necessary have to use withers for them) |
@TimWolla What do you think about verifying URI recomposition separately? Or do you think we should always test the recomposed URI after URI modification? |
Always, because this also helps the human reader understand the test better. |
If the tests follow a common structure / order, that's easy to check and scan. You could also insert an additional newline between the various output “sections”. |
Unless I'm really needed here I'm removing my review request. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Taken another look at the RFC 3986 tests now. Generally LGTM. Will still need to look at the WHATWG tests.
<?php | ||
|
||
$uri1 = Uri\Rfc3986\Uri::parse("https://example.com"); | ||
$uri2 = $uri1->withHost("t%65st.com"); // test.com |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we please use t%65st.example
as the replacement to avoid using “legit” domain names?
<?php | ||
|
||
$uri1 = Uri\Rfc3986\Uri::parse("https://example.com"); | ||
$uri2 = $uri1->withFragment("foo%3Dbar"); // foo=bar |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This seems to be unresolved still.
<?php | ||
|
||
$uri1 = Uri\Rfc3986\Uri::parse("https://example.com"); | ||
$uri2 = $uri1->withFragment("foo%3dbar"); // foo=bar |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we have a second encoding that can be normalized? e.g. %61 for the a
.
<?php | ||
|
||
$uri1 = Uri\Rfc3986\Uri::parse("https://example.com"); | ||
$uri2 = $uri1->withPath("/foo%2Fbar"); // /foo/bar |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we have a second encoding that can be normalized? e.g. %61 for the a.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Typo in filename “sensitive”.
<?php | ||
|
||
$uri1 = Uri\Rfc3986\Uri::parse("https://example.com"); | ||
$uri2 = $uri1->withQuery("foo%3dbar"); // foo=bar |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we have a second encoding that can be normalized? e.g. %61 for the a.
<?php | ||
|
||
$uri1 = Uri\Rfc3986\Uri::parse("https://example.com"); | ||
$uri2 = $uri1->withScheme("http"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
$uri2 = $uri1->withScheme("http"); | |
$uri2 = $uri1->withScheme("HTTP"); |
To allow for normalizing to happen.
No description provided.